package com.yufeng.collaboration.service.impl;

import com.yufeng.collaboration.entity.Notice;
import com.yufeng.collaboration.mapper.NoticeMapper;
import com.yufeng.collaboration.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NoticeServiceImpl implements NoticeService {
    @Autowired
    private NoticeMapper noticeMapper;

    @Override
    public List<Notice> getNoticesByReceiverId(String receiverId) {
        return noticeMapper.selectList(new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<Notice>().eq("receiver_id", receiverId));
    }

    @Override
    public void addNotice(Notice notice) {
        noticeMapper.insert(notice);
    }

    @Override
    public void deleteNotice(Integer id) {
        noticeMapper.deleteById(id);
    }
}